import request from '@/utils/request'

export function facilityList(query) {
  return request({
    url: '/jbl-business/api/admin/v1/label/getByConditionsPage',
    method: 'get',
    params: query
  })
}

export function facilityEdit(data) {
  return request({
    url: '/jbl-business/api/admin/v1/label/updateById',
    method: 'post',
    data
  })
}

export function facilityAdd(data) {
  return request({
    url: '/jbl-business/api/admin/v1/label/add',
    method: 'post',
    data
  })
}

export function facilityDetail(query) {
  return request({
    url: '/jbl-business/api/admin/v1/label/getById',
    method: 'get',
    params: query
  })
}

export function environmentList(query) {
  return request({
    url: '/jbl-business/api/admin/v1/label/getByConditionsPage',
    method: 'get',
    params: query
  })
}

export function environmentEdit(data) {
  return request({
    url: '/jbl-business/api/admin/v1/label/updateById',
    method: 'post',
    data
  })
}

export function environmentAdd(data) {
  return request({
    url: '/jbl-business/api/admin/v1/label/add',
    method: 'post',
    data
  })
}

export function environmentDetail(query) {
  return request({
    url: '/jbl-business/api/admin/v1/label/getById',
    method: 'get',
    params: query
  })
}

export function labelDel(query) {
  return request({
    url: '/jbl-business/api/admin/v1/label/deleteById',
    method: 'get',
    params: query
  })
}

// 部门管理
export function organizeDepartmentList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgDepartment/pageList',
    method: 'get',
    params: query
  })
}

export function organizeDepartmentAllList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgDepartment/list',
    method: 'get',
    params: query
  })
}

export function organizeDepartmentUpdate(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgDepartment/updateById',
    method: 'post',
    data
  })
}

export function organizeDepartmentAdd(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgDepartment/add',
    method: 'post',
    data
  })
}

export function organizeDepartmentDel(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgDepartment/deleteById',
    method: 'get',
    params: query
  })
}

export function organizePositionAllList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/list',
    method: 'get',
    params: query
  })
}

export function organizePositionAdd(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/add',
    method: 'post',
    data
  })
}

// 根据id查看权限
export function organizePositionCheckList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/listPermissionById',
    method: 'get',
    params: query
  })
}

// 职位状态编辑(启用、禁用)
export function organizePositionStatus(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/enableOrEnable',
    method: 'get',
    params: query
  })
}

// 员工管理
export function organizeEmployeeList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/pageList',
    method: 'get',
    params: query
  })
}

export function organizeEmployeeAdd(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/add',
    method: 'post',
    data
  })
}

export function organizeEmployeeEdit(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/updateById',
    method: 'post',
    data
  })
}

export function organizeEmployeeDel(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/deleteById',
    method: 'get',
    params: query
  })
}

export function organizeEmployeeStatus(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/updateStatus',
    method: 'get',
    params: query
  })
}

export function getEmployeeDetail(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/getById',
    method: 'get',
    params: query
  })
}

// 权限管理
export function organizeAuthorityList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/pageCascadeList',
    method: 'get',
    params: query
  })
}

export function organizeAuthorityDel(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/deleteById',
    method: 'get',
    params: query
  })
}

export function organizeAuthorityAllMenu(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/list',
    method: 'get',
    params: query
  })
}

export function organizeAuthorityAdd(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/add',
    method: 'post',
    data
  })
}

export function organizeAuthorityDetail(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/getById',
    method: 'get',
    params: query
  })
}

export function organizeAuthorityEdit(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/updateById',
    method: 'post',
    data
  })
}

// ---------------------------------------------------------------------

// 所有权限菜单
export function organizePositionRoleList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysPermission/cascadeList',
    method: 'get',
    params: query
  })
}

// 根据id查看权限(新)
export function organizePositionCheckNewList(query) {
  return request({
    url: '/jbl-user-center/api/admin/{version}/sysOrgRole/listPermissionById',
    method: 'get',
    params: query
  })
}

// -------------------------职位管理---------------------------------

// 职位管理list
export function organizePositionList(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/pageList',
    method: 'get',
    params: query
  })
}

// 职位编辑
export function organizePositionUpdate(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/updateById',
    method: 'post',
    data
  })
}
// 职位删除
export function organizePositionDelete(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/deleteById',
    method: 'get',
    params: query
  })
}

// 批量新增权限
export function organizePositionAddList(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRolePermission/batchAdd',
    method: 'post',
    data
  })
}

// 批量删除权限
export function organizePositionDeleteList(data) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRolePermission/deleteBatchByIds',
    method: 'post',
    data
  })
}

// 部门-验证部门名称是否已经存在
export function validateDepartmentName(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgDepartment/validateDepartName',
    method: 'get',
    params: query
  })
}

// 职位-验证职位名称是否已经存在
export function validateRoleName(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysOrgRole/validateRoleName',
    method: 'get',
    params: query
  })
}

// 员工-验证手机号是否已经存在
export function validatePhoneNumber(query) {
  return request({
    url: '/jbl-user-center/api/admin/v1/sysUser/validatePhone',
    method: 'get',
    params: query
  })
}

